# f = open('ga.cpp', 'r')
# seed_range = 1000
# s = f.readlines()
# for i in range(1, seed_range + 1):
#     t = s[28].split('=')
#     t[-1] = str(i) + ';\n'
#     s[28] = '='.join(t)
#     f2 = open('ga%d.cpp'%i, 'w')
#     for ss in s:
#         f2.write(ss)
#     f2.close()
# f = open('bootstrap.sh', 'w')
# for i in range(1, 251):
#     f.write('g++ -O3 ga%d.cpp -std=c++14 -o ga%d\n' %(i, i))
#     f.write('./ga%d < data_final.txt\n' %i)
# f = open('bootstrap1.sh', 'w')
# for i in range(251, 501):
#     f.write('g++ -O3 ga%d.cpp -std=c++14 -o ga%d\n' %(i, i))
#     f.write('./ga%d < data_final.txt\n' %i)
# f = open('bootstrap2.sh', 'w')
# for i in range(501, 751):
#     f.write('g++ -O3 ga%d.cpp -std=c++14 -o ga%d\n' %(i, i))
#     f.write('./ga%d < data_final.txt\n' %i)
# f = open('bootstrap3.sh', 'w')
# for i in range(751, 1001):
#     f.write('g++ -O3 ga%d.cpp -std=c++14 -o ga%d\n' %(i, i))
#     f.write('./ga%d < data_final.txt\n' %i)
f = open('result.txt', 'r')
mx = 100000000
pos = -1
for s in f.readlines():
    if int(s.strip().split()[-1]) < mx:
        mx = int(s.strip().split()[-1])
        print(s)
print(mx)